import { Input, Tree } from 'antd';
import type { DataNode } from 'antd/es/tree';
import React, { useState } from 'react';
const { Search } = Input;
const App: React.FC = () => {
  // const [_expandedKeys, setExpandedKeys] = useState<React.Key[]>([]);
  const [autoExpandParent, setAutoExpandParent] = useState(true);
  // newExpandedKeys: React.Key[]
  const onExpand = () => {
    // setExpandedKeys(newExpandedKeys);
    setAutoExpandParent(false);
  };

  const onChange = () => {};

  const treeData: DataNode[] = [
    {
      title: 'parent 1',
      key: '0-0',
      children: [
        {
          title: '2023-01-30-xlsw',
          key: '0-0-0',
        },
        {
          title: '2023-13-10-xlsw',
          key: '0-0-1',
        },
      ],
    },
  ];

  return (
    <div style={{ padding: '0 10px', height: '100%' }}>
      <Search style={{ marginBottom: 8 }} placeholder="Search" onChange={onChange} />
      {/* expandedKeys={expandedKeys} */}
      <Tree
        defaultExpandAll={true}
        showLine
        onExpand={onExpand}
        autoExpandParent={autoExpandParent}
        treeData={treeData}
      />
    </div>
  );
};

export default App;
